<template>
  <div class="DispatchOpenWindow">
    <div class="p10">
      <CodeArea :dt="dt" />
    </div>
    <div class="p10">
      <button @click="toOpenAWindow">打开一个窗口</button>
    </div>
  </div>
</template>
<script>
export default {
  name: "DispatchOpenWindow",
  data() {
    return {
      dt: `
        store/desk //目录指向
        const app = {
          name: "onlyKey",
          meta: {
            label: "js打开一个窗口",
            icon: "",
            type: "",
          },
          attrs: {}, //初始属性
          component: () => import(""),
        }
        //vuex store用法来调用
        this.$store.dispatch("desk/openWindow", app)
      `,
    }
  },
  methods: {
    toOpenAWindow() {
      const app = {
        name: "onlyKey",
        meta: {
          label: "js打开一个窗口",
          icon: "",
          type: "",
        },
        attrs: {}, //初始属性
      }
      this.$store.dispatch("desk/openWindow", app)
    },
  },
}
</script>
<style lang="scss" scoped></style>
